package com.naiterui.ehp.bs.cms.modules.common.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import com.naiterui.ehp.bs.cms.common.constants.CacheConstants;
import com.naiterui.ehp.bs.cms.common.entity.BaseTree;
import com.naiterui.ehp.bs.cms.modules.common.mapper.CityMapper;
import com.naiterui.ehp.bs.cms.modules.common.service.ICityService;
import com.naiterui.ehp.bs.cms.modules.common.vo.CityVO;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@Service
public class CityServiceImpl implements ICityService {

    @Autowired
    private CityMapper cityMapper;

    @Override
    @Cacheable(value = CacheConstants.CITY, key = "#type")
    public List<CityVO> queryCityList(String type) {
        List<CityVO> list = this.cityMapper.findAll(type);
        return BaseTree.listToTree(list);
    }
}
